﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace _0712502_0712504_DesignPatternGame
{
    public class HealthyBarDrawer : VisibleGameObject
    {
        Texture2D _boxImg;
        Point _spaceSize;
        public HealthyBarDrawer(Texture2D inputImg, Point size, Point spaceSize)
        {
            this._boxImg = inputImg;
            this.Size = new Rectangle(0, 0, size.X, size.Y);
            this._spaceSize = spaceSize;
        }

        public void DrawToScreen(SpriteBatch spriteBatch, int CurValue, int MaxValue)
        {
            float rate =  1.0f*CurValue / MaxValue;
            float length = rate * 54;
            double red = (1.0f - CurValue / MaxValue) * 255;
            double green = 255 * CurValue / MaxValue;
            spriteBatch.Draw(_boxImg, this.Position, Color.White);
            spriteBatch.Draw(_boxImg, new Rectangle((int)Position.X, (int)Position.Y, (int)length, 10), new Color((int)red, (int)green, 0));
           
        }
    }
}
